import logging
from pyramid.view import view_config
from bbkb import mturk
from bbkb import stats
from bbkb.KnowledgeBase import KnowledgeBase as kb
from bbkb.KBQuery import query_knowledgebase

log = logging.getLogger(__name__)

@view_config(route_name='mturk_index_view', renderer='bbkb:templates/mturk.pt')
def index_view(request):
    """Default index handler"""
    return {
        'mturk_filenames':sorted(mturk.surveys),
    }
    
@view_config(route_name='mturk_retrieve_view', renderer='json')
def get_mturk_survey(request):
	"""Retrieves queries for specified survey"""
	survey = request.params['survey']
	return {
		'data':sorted(mturk.surveys[survey])
	}

